// 钉枪999子弹

string author = "Live";
string pluginName = "NailgunMax 钉枪999";
string version = "0.2";

// 插件初始化
void OnPluginInit()
{
    // 设置插件信息
    PluginData::SetAuthor(author);
    PluginData::SetName(pluginName);
    PluginData::SetVersion(version);

    // 提示
    ThePresident.InfoFeed("插件:"+pluginName+"| 版本:"+version+"| 作者:"+author,false);
	
	// 玩家说
    Events::Player::PlayerSay.Hook( @PlayerSay );
}

HookReturnCode PlayerSay(CTerrorPlayer@ pPlayer, CASCommand@ pArgs)
{
    string arg = pArgs.Arg( 1 );
	string arg1 = "";
	string arg2 = "";

	// 切分字符串(这样就可以用空格传一个命令参数了)
	int subIndex = arg.findFirst(" ",0);
	if(not (subIndex < 0)){
		arg1 = arg.substr(0,subIndex);
		arg2 = arg.substr(subIndex+1,-1);
		//Chat.PrintToChat(all,""+arg1+"|"+arg2);
	}else{
		arg1 = arg;
	}
	
	
	if( arg1 == "!nailgun" ){
		pPlayer.GiveWeapon("nailgun");
		CBaseEntity@ BaseWeapon = pPlayer.GetCurrentWeapon();
		if( BaseWeapon.GetClassname() == "weapon_nailgun" ){
			CTerrorWeapon@ Weapon = ToTerrorWeapon(BaseWeapon);
			Weapon.m_iClip = 999;
		}
	}
	
	return HOOK_CONTINUE;
}